import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    "userName":"Canwin",
    "address":"北京",
    "isLogin":false,
    "user":[
      {
        "name":"Canwin",
        "pass":"yang666..."
      }
    ]
  },
  getters: {
  },
  mutations: {
    getAddress(e,e2){//收到参数以及获取用户地址
      e.address=e2
    },
    ISLOGIN(e1,e2){//收到参数，判断登录状态
        e1.isLogin=e2
    },
    ADD(e1,e2){//注册后添加用户
      e1.user.push({"name":e2.age,"pass":e2.pass})
    },
    ISUSER(e1,e2){//显示当前登录用户的名字
        e1.userName=e2
    }
  },
  actions: {
  },
  modules: {
  }
})
